#!/bin/bash

# you need to edit to where your server dir is.
SERVER_DIR="/srv/L1server"

# Check working directory for serverstart.sh before failing
if [[ -f ./serverstart.sh ]]; then
  SERVER_DIR="./"
fi

if [[ ! -d "${SERVER_DIR}" ]]; then
  echo "Edit l1server_startup.sh to point to your L1J-EN directory."
  exit 1
fi

cd ${SERVER_DIR}

# open up a new terminal window if gnome is running
if [[ -n "$(ps -e | grep -i gnome)" ]]; then
  gnome-terminal --execute ./serverstart.sh
else
  ./serverstart.sh &
fi
